﻿<!--#include file="config.asp"-->
<%
''' SDCMS 财付通充值
''' ==================================================================
''' 版权所有 http://www.sdcms.cn
''' ------------------------------------------------------------------
''' 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用；
''' 未经授权不允许对程序代码以任何形式任何目的的再发布。
''' ==================================================================
''' 编写: IT平民
''' 修改：IT平民 in 2013.03

function getstrrandnumber(byval max,byval min)
	dim randnumber
	randomize 
	randnumber=cint((max-min+1)*rnd()+min) 
	getstrrandnumber=cstr(randnumber)
end function

sub qq_api()
	dim orderid,total_fee
	orderid=sdcms.enhtml(sdcms.fget("t0",0))
	total_fee=sdcms.getint(sdcms.fget("t1",0),0)
	total_fee=total_fee*100
	if sdcms.strlen(orderid)=0 or total_fee<1 then
		sdcms.script("alert(""参数错误"")")
		sdcms.script("window.close()")
		exit sub
	end if

	dim getstrnow:getstrnow=sdcms.getdate(now(),"",1)
	dim transaction_id:transaction_id=appid&getstrnow&right(getstrnow,6)&getstrrandnumber(1000,9999)
	dim url:url=api_url&"?"
	dim url_01,url_02,url_03,url_04,url_05,url_06,url_07,url_08,url_09,url_10,url_11,url_12,url_13,url_14,url_15
	dim urlmd5,url_08_01,url_10_01
		url_01="cmdno=1"
		url_02="&date="&getstrnow
		url_03="&bargainor_id="&appid
		url_04="&transaction_id="&transaction_id
		url_05="&sp_billno="&orderid
		url_06="&total_fee="&total_fee
		url_07="&fee_type=1"
		url_08="&return_url="&return_url
		url_09="&attach="
		url_10="&spbill_create_ip="&sdcms.getip
		url_11="&key="&appkey
		urlmd5=MD5_32(url_01&url_02&url_03&url_04&url_05&url_06&url_07&url_08&url_09&url_10&url_11)

		'尼玛，金额大于1的不允许跳转，只能模拟表单提交
		dim t1
		t1="<form id='qqsubmit' name='alipaysubmit' action='"&api_url&"' method='post'>"
		t1=t1&"<input type='hidden' name='cmdno' value='1'>"
		t1=t1&"<input type='hidden' name='date' value='"&getstrnow&"'>"
		t1=t1&"<input type='hidden' name='fee_type' value='1'>"
		t1=t1&"<input type='hidden' name='attach' value=''>"
		t1=t1&"<input type='hidden' name='bank_type' value='0'>"
		t1=t1&"<input type='hidden' name='cs' value='utf-8'>"
		t1=t1&"<input type='hidden' name='bargainor_id' value='"&appid&"'>"
		t1=t1&"<input type='hidden' name='sp_billno' value='"&orderid&"'>"
		t1=t1&"<input type='hidden' name='transaction_id' value='"&transaction_id&"'>"
		t1=t1&"<input type='hidden' name='total_fee' value='"&total_fee&"'>"
		t1=t1&"<input type='hidden' name='return_url' value='"&return_url&"'>"
		t1=t1&"<input type='hidden' name='desc' value='"&"在线充值，订单号："&orderid&"'>"
		t1=t1&"<input type='hidden' name='spbill_create_ip' value='"&sdcms.getip&"'>"
		t1=t1&"<input type='hidden' name='sign' value='"&urlmd5&"'>"
		t1=t1&"</form>"
		t1=t1&"<script>document.forms['qqsubmit'].submit();</script>"
			
		sdcms.echo t1
end sub
qq_api
%>